<template>
  <div class="top-nav flex-box">
    <router-link tag="div" :to="{ path: '/'}" class="logo"></router-link>
    <div class="search flex flex-box">
      <input class="input input-line" placeholder="关键词" type="text">
      <div class="btn_search">搜索</div>
    </div>
    <div v-if="userinfo.id > 0" class="btn_login">个人</div>
    <div v-else class="btn_login" @click="login">登录</div>
    <div class="btn_menu">菜单</div>
  </div>
</template>

<script>
export default {
  name: "PlaneHeader",
  computed: {
    userinfo() {
      return this.$store.state.userinfo;
    }
  },
  methods: {
    login() {
      this.$store.commit('loginShow');
    }
  }
};
</script>
<style scoped lang="less">
.search {
  margin: 0 .5rem;
  background: rgba(255, 255, 255, .2);
  border-radius: .1rem;
  overflow: hidden;
  .input {
    background: transparent;
  }
}
.top-nav {
  padding: 0 0.5rem;
  align-items: center;
  height: 2.25rem;
  background: #32393e;
  .logo {
    width: 3rem;
    height: 2.25rem;
    background-image: url("../../assets/logo.png");
    background-position: center center;
    background-repeat: no-repeat;
    background-size: 100% auto;
  }
  .btn_search {
    background: transparent;
    color: #999;
    border: 0;
    padding: 0;
    margin: 0;
    width: 3rem;
    text-align: center;
    line-height: 1.4rem;
  }
  .btn_login,.btn_menu {
    color: #FFFFFF;
  }
  .btn_login {
    margin-right: .5rem;
  }
}
</style>
